home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11055 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: dawn.mmm.com!news
  2. From: kjhopps@mmm.com (Kevin J Hopps)
  3. Newsgroups: comp.lang.c++,comp.os.ms-windows.programmer.tools.mfc
  4. Subject: Re: Best way to resume from an exception
  5. Followup-To: comp.lang.c++,comp.os.ms-windows.programmer.tools.mfc
  6. Date: 12 Mar 1996 15:01:47 GMT
  7. Organization: 3M - St. Paul, MN  55144-1000 US
  8. Message-ID: <4i43kr$8nu@dawn.mmm.com>
  9. References: <4i1qr9$g15@nntp1.best.com>
  10. Reply-To: kjhopps@mmm.com
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. DrLaz@aol.com wrote:
  14. > OK, wizards, what do you-all think is the best way to pick up after an
  15. > exception from the point at which it was thrown? For example--
  16.  
  17. > try{
  18. >     // code that does a lot of 'new', much of it in MSVC library code
  19. >     //  (so I can't check every new myself)
  20. > }
  21. > catch(CMemoryException* e){
  22. >     // delete some purgeable stuff that can be re-fetched later
  23. >     // oops, now what!
  24. > }
  25. > I could even try a 'goto' to the try block, since I in this case the
  26. > variables are initialized before the try, but I' sure someone has
  27. > thought about this deeply.
  28.  
  29. Exceptions are not designed to make this easy or possible.  It was a
  30. very conscious decision to use a termination model rather than a
  31. resumption model.
  32.  
  33. If retrying is desired, the normal method is to put the try block inside
  34. a loop.
  35. --
  36. Kevin J. Hopps, 3M Company     kjhopps@mmm.com
  37. Opinions are my own.  I don't speak for 3M.
  38.     But 3M speaks for me -- I did not write the following line:
  39.  
  40. Opinions expressed herein are my own and may not represent those of 3M.
  41.